home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / Run & Stumpy / source / volumeinfo.h < prev    next >
Encoding:
Text File  |  1992-06-18  |  2.4 KB  |  73 lines  |  [TEXT/MPS ]

  1. // volumeinfo.h
  2.  
  3. #ifndef volumeinfo_h
  4. #define volumeinfo_h
  5.  
  6. #include <files.h>
  7.  
  8. #ifndef inttypes_h
  9. #include "inttypes.h"
  10. #endif
  11. #ifndef errorsource_h
  12. #include "errorsource.h"
  13. #endif
  14.  
  15. class volumeinfo: public errorsource
  16.   {
  17.     private:
  18.         HParamBlockRec pb;
  19.         enum
  20.           {
  21.             hardlockbit=  0x0080,
  22.             softlockbit=  0x8000,
  23.             bothlockbits= 0x8080
  24.           };
  25.         enum
  26.           {
  27.             mfssignature= 0xD2D7,
  28.             hfssignature= 0x4244
  29.           };
  30.         Str31 thename;
  31.     public:
  32.         volumeinfo()                {}
  33.         volumeinfo( const Str31& name );
  34.         volumeinfo( int16 refnum );
  35.         boolean nth( uint16 );
  36.         
  37.         const Str31& name() const                { return thename; }
  38.         int16 refnum() const                        { return pb.volumeParam.ioVRefNum; }
  39.         
  40.         long creationdate() const                { return pb.volumeParam.ioVCrDate; }
  41.         long modificationdate() const            { return pb.volumeParam.ioVLsMod; }
  42.         long backupdate() const                    { return pb.volumeParam.ioVBkUp; }
  43.         
  44.         boolean hardwarelock() const    { return pb.volumeParam.ioVAtrb & hardlockbit; }
  45.         boolean softwarelock() const    { return pb.volumeParam.ioVAtrb & softlockbit; }
  46.         boolean locked() const            { return pb.volumeParam.ioVAtrb & bothlockbits; }
  47.  
  48.         uint16 rootfilecount() const                { return pb.volumeParam.ioVNmFls; }
  49.         uint16 filecount() const                    { return pb.volumeParam.ioVFilCnt; }
  50.         uint16 directorycount() const                { return pb.volumeParam.ioVDirCnt; }
  51.  
  52.         uint16 bitmapstart() const                    { return pb.volumeParam.ioVBitMap; }
  53.         uint16 nextallocation() const                { return pb.volumeParam.ioAllocPtr; }
  54.         uint16 allocationblockcount() const        { return pb.volumeParam.ioVNmAlBlks; }
  55.         uint16 allocationblocksize() const        { return pb.volumeParam.ioVAlBlkSiz; }
  56.         uint16 clumpsize() const                    { return pb.volumeParam.ioVClpSiz; }
  57.         uint16 allocationmapstart() const        { return pb.volumeParam.ioAlBlSt; }
  58.         uint16 nextfileid() const                    { return pb.volumeParam.ioVNxtCNID; }
  59.         uint16 allocationblocksfree() const        { return pb.volumeParam.ioVFrBlk; }
  60.         
  61.         uint16 signature() const            { return pb.volumeParam.ioVSigWord; }
  62.         boolean mfs() const                    { return signature() == mfssignature; }
  63.         boolean hfs() const                    { return signature() == hfssignature; }
  64.         
  65.         uint16 drivenumber() const                    { return pb.volumeParam.ioVDrvInfo; }
  66.         uint16 driver() const                        { return pb.volumeParam.ioVDRefNum; }
  67.         uint16 filesystem() const                    { return pb.volumeParam.ioVFSID; }
  68.  
  69.         uint16 writecount() const                    { return pb.volumeParam.ioVWrCnt; }
  70.   };
  71.  
  72. #endif volumeinfo_h
  73.